@extends('layouts.home')
@section('css')
    <link rel="stylesheet" href="{{ asset('css/home/article.min.css') }}">
    <link rel="stylesheet" href="{{ asset('css/home/prism.css') }}">
    <style>
    .news_title{
        font-size: 36px;text-align: center;
    }
    .tags>a {
        background: #F4650E;
        padding: 3px 8px;
        margin: 0 5px 0 0;
        color: #fff;
        border-radius: 2010px;
    }
</style>
@stop
@section('content')
    <main>
        <div class="infosbox">
            <div class="newsview markdown-body editormd-preview-container editormd-preview-active">
                <h1 class="news_title">{{$article->title}}</h1>
                <div class="bloginfo">
                    <ul>
                        <li class="author">作者：<a href="/">{{$article->author}}</a></li>
                        <li class="lmname">分类:<a href="{{url("home/index/category",$article->category->id)}}">{{$article->category->name}}</a></li>
                        <li class="timer">发布于：{{$article->created_at}}</li>
                        {{--<li class="view">{{$article->click}}人已阅读</li>--}}
                        <li>
                            <div class="tags">标签：
                                @foreach($article->tag as $v)
                                    <a href="{{url("home/index/tag",$v->id)}}" target="_blank">{{$v->name}}</a> &nbsp;
                                @endforeach
                            </div>
                        </li>
                    </ul>
                </div>
                {{--<div class="tags"><a href="/" target="_blank">个人博客</a> &nbsp; <a href="/" target="_blank">小世界</a></div>--}}
                {{--<div class="news_about"><strong>简介</strong>个人博客，用来做什么？我刚开始就把它当做一个我吐槽心情的地方，也就相当于一个网络记事本，写上一些关于自己生活工作中的小情小事，也会放上一些照片，音乐。每天工作回家后就能访问自己的网站，一边听着音乐，一边写写文章。</div>--}}
                <div  class="news_con">
                    {!! $article->html !!}
                </div>
            </div>
            <div class="share">
                <p class="diggit"><a href="JavaScript:makeRequest('/e/public/digg/?classid=3&amp;id=19&amp;dotop=1&amp;doajax=1&amp;ajaxarea=diggnum','EchoReturnedText','GET','');"> 很赞哦！ </a>(<b id="diggnum"><script type="text/javascript" src="/e/public/ViewClick/?classid=2&id=20&down=5"></script>13</b>)</p>
            </div>
            <div class="nextinfo">
                @if(is_null($preArticle))
                    <p>上一篇：<span>没有了</span></p>
                @else
                    <p>上一篇：<a href="{{url("home/index/article",$preArticle->id)}}">{{$preArticle->title}}</a></p>
                @endif
                @if(is_null($nextArticle))
                    <p>下一篇：<span>没有了</span></p>
                @else
                    <p>下一篇：<a href="{{url("home/index/article",$nextArticle->id)}}">{{$nextArticle->title}}</a></p>
                @endif
            </div>
            <div class="news_pl">
                {{--<form action="{{url("/home/index/comment")}}" method="post" name="saypl" id="saypl" onsubmit="return CheckPl(document.saypl)">--}}
                    {{--{{ @csrf_field() }}--}}
                    <div id="plpost">
                        <p class="saying"><span><a href="/e/pl/?classid=77&amp;id=106">共有<script type="text/javascript" src="/e/public/ViewClick/?classid=77&amp;id=106&amp;down=2"></script>{{count($comments)}}条评论</a></span>来说两句吧...</p>
                        {{--<p class="yname"><span>用户名:</span>--}}
                        {{--<input name="username" type="text" class="inputText" id="username" value="" size="16">--}}
                        {{--</p>--}}
                        {{--<p class="yzm"><span>验证码:</span>--}}
                        {{--<input name="key" type="text" class="inputText" size="16">--}}
                        {{--</p>--}}
                        {{--<input name="article_id"  type="text" class="inputText" value="{{$article->id}}" size="16">--}}
                        {{--<input name="pid" type="text" class="inputText" value="0" size="16">--}}
                        <textarea name="content" rows="6" @if(!session("user"))placeholder="请登录后评论"@endif id="saytext"></textarea>
                        <button class="commentbutton" data-articleid="{{$article->id}}" data-pid="0">提交</button>
                    </div>
                {{--</form>--}}

                <h2>文章评论</h2>
                <div class="gbko">
                    {{--<script src="/e/pl/more/?classid=77&amp;id=106&amp;num=20"></script>--}}
                    @foreach($comments as $v)
                        <div class="fb">
                            <ul class="fc">
                                <li><img src="{{$v['avatar']}}" /></li>
                                <li class="fc_content">
                                    <p class="fbtime">{{$v['name']}}</p>
                                    <p class="fbinfo">{{$v['content']}}</p>
                                    <span class="timeandreply">{{$v['created_at']}}&nbsp;&nbsp;&nbsp;<a href="javascript:;" data-pid="{{$v['id']}}" class="reply">回复</a></span>
                                </li>
                                @foreach($v['child'] as $sv)
                                    <li class="fs">
                                        <ul class="fc">
                                            <li><img src="{{$sv['avatar']}}" /></li>
                                            <li class="fc_content">
                                                <p class="fbtime">{{$sv['name']}}回复{{$sv['reply_name']}}</p>
                                                <p class="fbinfo">{{$sv['content']}}</p>
                                                <span class="timeandreply">{{$sv['created_at']}}&nbsp;&nbsp;&nbsp;<a href="javascript:;" data-pid="{{$sv['id']}}" class="reply">回复</a></span>
                                            </li>

                                        </ul>
                                    </li>
                                @endforeach
                            </ul>
                        </div>
                    @endforeach
                </div>
            </div>
        </div>
    </main>
@stop
@section('js')
    <script>
        //定义一些变量，js中使用
        isloginurl="{{url('home/index/islogin')}}"
        commenturl="{{url('home/index/comment')}}"
        csrf_token="{{ csrf_token() }}"
        username="{{session('user.name')}}"
        useravatar="{{session('user.avatar')}}"
        article_id="{{$article->id}}";
    </script>
    <script src="{{ asset('js/home/comment.js')}}" type="text/javascript"></script>
    <script src="{{ asset('js/home/prism.js')}}" type="text/javascript"></script>
@stop